# 方法一 字典法
name = input()
name_a = {'A0':'1189\n841','A1':'841\n594','A2':'594\n420',
          'A3':'420\n297','A4':'297\n210','A5':'210\n148',
          'A6':'148\n105','A7':'105\n74','A8':'74\n52','A9':'52\n37'}
print(name_a[name])
# 方法二
x = int(input()[1])
a, b = 1189, 841
for i in range(x):
    a //= 2
    if a < b:
        a, b = b, a
print(a)
print(b)
